import { getAction, postAction, putAction, deleteAction } from '@/api/manage'

// 出库单路径
const outboundPrefix = '/wms/outbound'

// 出库单列表
const getOutboundList = (params) => getAction(`${outboundPrefix}/list`, params)

// 出库单详情
const getOutboundById = (params) => getAction(`${outboundPrefix}/queryById`, params)

// 新增出库单
const addOutbound = (params) => postAction(`${outboundPrefix}/add`, params)

// 编辑出库单
const editOutbound = (params) => putAction(`${outboundPrefix}/edit`, params)

// 取消出库单
const cancelOutbound = (params) => putAction(`${outboundPrefix}/cancel`, params)

// 审核出库单
const auditOutbound = (params) => putAction(`${outboundPrefix}/audit?id=${params.id}&isPass=${params.isPass}&remark=${params.remark || ''}`)

// 执行出库
const executeOutbound = (params) => putAction(`${outboundPrefix}/execute`, params)

// 打印出库单
const printOutbound = (params) => getAction(`${outboundPrefix}/print`, params)

// 上传出库凭证
const uploadVoucher = (params) => postAction(`${outboundPrefix}/uploadVoucher`, params)

// 根据订单号获取可用领料单
const getRequisitionByOrderNo = (params) => getAction(`/wms/requisition/listByOrderNo`, params)

// 查询物料库存
const getInventoryByMaterial = (params) => getAction(`/wms/inventory/queryByMaterialAndWarehouse`, params)

// 解析余料出库文件
const parseRemainingMaterialFile = (params) => postAction(`${outboundPrefix}/parseRemainingMaterialFile`, params)

// 保存余料出库单
const saveRemainingMaterialOutbound = (params) => postAction(`${outboundPrefix}/saveRemainingMaterialOutbound`, params)

export {
  getOutboundList,
  getOutboundById,
  addOutbound,
  editOutbound,
  cancelOutbound,
  auditOutbound,
  executeOutbound,
  printOutbound,
  uploadVoucher,
  getRequisitionByOrderNo,
  getInventoryByMaterial,
  parseRemainingMaterialFile,
  saveRemainingMaterialOutbound
}